///
/// The following code creates the input for the tables for the Full Model results section
/// 



clear all
clear matrix
set more off

// Load data
use "~/Dropbox/Replication_MVC/Datasets/Survey_excombatants/survey_excombatants.dta", clear

// Prep data	
encode (Municipio), gen(origmun)
encode (Enumerator_name), gen(enumerator)
encode (ID_CODA), gen (id)

// Def crime acceptable variable
gen crime_ok=.
replace crime_ok= Social_crime22_a
replace crime_ok= Social_crime22_b if crime_ok==.

gen crime_ok2=.
replace crime_ok2= Social_crime23_a
replace crime_ok2= Social_crime23_b if crime_ok2==.
	
gen crime_acceptable=.
replace crime_acceptable= crime_ok + crime_ok2
replace crime_acceptable= crime_acceptable/2


eststo clear
set more off

reg crime_acceptable Aftedemo_Security i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store A5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A1.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Security) ///
	   ti("Survey Figure Results") ///
	   replace 
 
eststo clear
set more off	   
reg crime_acceptable Aftedemo_Econsecurity   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store B5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A2.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Econsecurity) ///
	   ti("Survey Figure Results") ///
	   replace
	   
	   
eststo clear
set more off
reg crime_acceptable Aftedemo_Image   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store C5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A3.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Image) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Aftedemo_friends   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store D5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A4.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_friends) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Aftedemo_socialstatus   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store F5	  
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A5.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_socialstatus) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Aftedemo_Adventure   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store G5	  
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A6.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Adventure) ///
	   ti("Survey Figure Results") ///
	   replace
	
eststo clear
set more off
reg crime_acceptable Aftedemo_Knoledge   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store H5	  
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A7.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Knoledge) ///
	   ti("Survey Figure Results") ///
	   replace
	   
eststo clear
set more off
reg crime_acceptable Aftedemo_Money   i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store I5	  
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A8.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Aftedemo_Money) ///
	   ti("Survey Figure Results") ///
	   replace
	   
eststo clear
set more off	   
reg crime_acceptable Obligation_contact  i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store J5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A9.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Obligation_contact) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Obligation_excombatant  i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store K5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A10.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Obligation_excombatant) ///
	   ti("Survey Figure Results") ///
	   replace

	   eststo clear
set more off
reg crime_acceptable Obligation_family i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store L5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A11.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Obligation_family) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Distance_to_commander  i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store M5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A12.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Distance_to_commander) ///
	   ti("Survey Figure Results") ///
	   replace

eststo clear
set more off
reg crime_acceptable Time_message_commander i.origmun i.enumerator  if ExGrupo=="AUC", r cluster(origmun)
estimates store N5
estadd local MunFE = "$\checkmark$"
estadd local EnuFE = "$\checkmark$"
eststo  
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA45_A13.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   keep(Time_message_commander) ///
	   ti("Survey Figure Results") ///
	   replace
